package com.ohuang.simpledatabase;

import org.json.JSONException;
import org.json.JSONObject;

public class AA {

    public String key;
    public String value;

    public AA(String key, String value) {
        this.key = key;
        this.value = value;
    }



     public static AA json2Data(String json){
         try {
             JSONObject jsonObject = new JSONObject(json);
             String key1 = jsonObject.getString("key");
             String value=jsonObject.getString("value");
             return new AA(key1,value);
         } catch (JSONException e) {

         }
        return null;
     }

    @Override
    public String toString() {
        try {
            return new JSONObject().put("key",key).put("value",value).toString();
        } catch (JSONException e) {

        }
        return "";
    }
}
